# def add(x, y):
#     theSum = 0
#     for a in range(x, y + 1):
#         theSum += a
#     print(theSum)
#
#
# add(1, 100)
# add(300, 400)
# add(1, 1000)

# def add(x, y):
#     theSum = 0
#     for a in range(x, y + 1):
#         theSum += a
#     return theSum
#
#
# result = add(1, 100)
# print(result)
# result = add(1, 100)
# print(result)
# result = add(1, 100)
# print(result)


# def is_odd(num):
#     if num % 2 == 1:
#         return "奇数"
#     else:
#         return "偶数"
#
#
# result = is_odd(2)
# print(result)
# result = is_odd(3)
# print(result)

# def is_odd(num):
#     if num % 2 == 1:
#         return "奇数"
#     return "偶数"
#
#
# result = is_odd(2)
# print(result)
# result = is_odd(3)
# print(result)


# def get_point():
#     x = 10
#     y = 20
#     return x, y
#
#
# x, y = get_point()
# print(x, y)

# def get_point():
#     x = 10
#     y = 20
#     return x, y
#
#
# _, y = get_point()
# print(y)

# x = 10
#
#
# def set_num():
#     x = 20
#     return x
#
#
# print(x)
# result = set_num()
# print(result)

x = 10


# def set_num():
#     global x
#     x = 20
#     print(f"函数内部x = {x}")
#
#
# set_num()
# print(f"函数外部x = {x}")


# def test():
#     print("执行函数体代码")
#     print("执行函数体代码")
#     print("执行函数体代码")
#
#
# print("aaaaaaaaaa")
# test()
# print("bbbbbbbbbb")
# test()
# print("cccccccccc")

# def a():
#     print("a")
#     b()
#
# def b():
#     print("b")
#     c()
#
#
# def c():
#     print("c")
#     d()
#
#
# def d():
#     print("d")
#
#
# a()

# 关键字参数
def test(x, y):
    print(f"x = {x}, y = {y}")


test(x=5, y=10)
test(y=20, x=10)

# 参数默认值设置
# def test(x, y, debug):
#     if debug:
#         print(f"x = {x}, y = {y}")
#
#
# test(x=10, y=20, debug=False)
# test(x=1, y=2, debug=True)


# def test(x, y, debug=False):
#     if debug:
#         print(f"x = {x}, y = {y}")
#
#
# test(x=10, y=20)
# test(x=1, y=2, debug=True)
